import React from "react"


export default function RefsandtheDOM(props){
    return <RefComp/>
}

 function RefComp(props){
    const userNameRef = React.createRef()

    function focus(){
        userNameRef.current.focus()
    }
    return <div>
        <input ref={userNameRef} value={"please input your name"}></input>
        <button onClick={()=>focus()}>focus input</button>
    </div>
}